package com.service.impl;

import org.springframework.ws.soap.server.endpoint.annotation.SoapAction;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.SOAPBinding;

@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
@WebService(targetNamespace="http://impl.service.com/")
public class WeatherService implements com.service.WeatherServiceInter {


    @Override
    public String getWeatherByCityname(String name,String code) {
        System.out.println(name + code + "天气晴朗。");
        return name +code+ "天气晴朗";
    }

    @Override
    public String GetSchema(String schemaCode) {

        System.out.println(schemaCode);
        return " {\"Code\":\"D001062ceshi2\",\"Items\":[{\"Name\":\"F0000001\",\"DisplayName\":\"单行文本\",\"DataType\":\"String\"},]}";
    }


    @Override
    public String GetSchemaList() {
        return  "{\"customer\": \"测试\",\"D001062ceshi2\": \"测试\"}";
    }

    @Override
    public String GetList(String userId,
                          String schemaCode,
                          String filter) {
        return  "{\"Code\":\"0\",\"Message\":\"获取数据成功\",\"Schema\":{\"Code\":\"D001062ceshi2\",\"Items\":[{\"name\":\"F0000001\",\"DisplayName\":\"单行文本\",\"DataType\":\"String\"}],},\"Data\":[\"F0000001\":\"c而是\"]}";
    }

    @Override
    @WebMethod(operationName = "Invoke", action = "http://impl.service.com/Invoke")
    @SoapAction("http://impl.service.com/Invoke")
    public String Invoke(@WebParam(name = "userCode",targetNamespace = "http://impl.service.com/") String userCode,
                         @WebParam(name = "schemaCode",targetNamespace = "http://impl.service.com/") String schemaCode,
                         @WebParam(name = "methodName",targetNamespace = "http://impl.service.com/") String methodName,
                         @WebParam(name = "param",targetNamespace = "http://impl.service.com/") String param) {
        System.out.println(param);
        System.out.println(userCode);
        System.out.println(schemaCode);
        System.out.println(methodName);

        System.out.println("222");
        return "{\"ResultCode\":\"0\",   \"Message\":\"\",   \"Schema\":{\"Code\":\"Student\",\"Items\":[{\"Name\":\"Name\",\"DisplayName\":\"学生姓名\",\"DataType\":\"String\"},{\"Name\":\"Age\",\"DisplayName\":\"学生年龄\",\"DataType\":\"Int\"},{\"Name\":\"ReturnData\",\"DisplayName\":\"子表数据\",\"DataType\":\"BizStructureArray\",\"ChildSchema\":{\"Code\":\"ResultObject\",\"Items\":[{\"Name\":\"ResultCode\",\"DisplayName\":\"执行结果代码\",\"DataType\":\"Int\"},{\"Name\":\"ErrorMessage\",\"DisplayName\":\"异常原因\",\"DataType\":\"String\"}]}}]},   \"Data\":{\"Name\":\"张三\",\"Age\":\"10\",\"ReturnData\":[{\"ResultCode\":\"0\",\"ErrorMessage\":\"0\"},{\"ResultCode\":\"1\",\"ErrorMessage\":\"1\"}]}}";
    }
}

